<?php 
header("Content-type:text/html;charset=utf-8");
require_once('videomodel.php');
require_once('controller.php');
class videocontroller extends controller{
	function listvideos(){
	$videomodel = new videomodel();
	$data = $videomodel->getvideolist();
	//var_dump($data);
	include "video/videoList.php";
	}
	function videoform(){
		include "video/videoForm.php";
	}
	function addvideo(){
		$data = $_POST;
		//var_dump($data);
		$model = new videomodel();
		$result = $model->addvideo($data);
		if($result){
			echo "成功".'<a href="ind.php?c=video&m=listvideos">回到视频列表</a>';
		}else {
			echo "失败";
		}
	}
	function videoedit(){
		$videoeditmodel = new videomodel();
		$data = $videoeditmodel->getvideobyid($_GET['id']);
		//var_dump($data[0]);
		include "video/videoEditForm.php";
	}
	function updatevideo(){
		$data = $_POST;
		//var_dump($data);
		$videomodel = new videomodel();
		$result = $videomodel->updatevideo($data);
		if($result){
			echo "成功".'<a href="ind.php?c=video&m=listvideos">回到视频列表</a>';
		}else {
			echo "失败";
		}
	}
	function delvideo(){
		$id = $_GET['id'];
		//var_dump($data);
		$model = new videomodel();
		$result = $model->delvideo($id);
			if($result){
			echo "成功".'<a href="ind.php?c=video&m=listvideos">回到视频列表</a>';
		} else 
		{
			echo "失败";
		}
	}
	function search(){
		$data = $_POST;
		//var_dump($data);
		$model = new videomodel();
		$data = $model->GetVideoBySearch($data);
		//var_dump($data);
		include "video/videoList.php";
	}



}




 ?>